package com.project.controller;

import com.project.bean.ProductResultBean;
import com.project.service.IProductService;
import com.project.service.ProductResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("productResult")
public class ProductResultController {
      @Autowired
      private ProductResultService productResultService;
      @Autowired
      private IProductService service;
      @RequestMapping("findAll()")
      public List<ProductResultBean> findAll(String productNum){
            return productResultService.findAll(productNum);
      }
      
      public void add(ProductResultBean productResultBean){
            //接收后端的ma
      productResultService.add(productResultBean);
      if(productResultBean.getResult()==1){
            service.updateProductStatus(0,productResultBean.getProductNum());
      }else {
            service.updateProductStatus(3,productResultBean.getProductNum());
      }
      }
}
